﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using WangMiEntity.EmployeeService;
using WangMiBusiness.GridViewModel;
using TaoBaoServices;

namespace WangMiBusiness.EmployeeService
{
    public class ZhuanHuaLvBusiness
    {

        /// <summary>
        /// 按日期排列
        /// </summary>
        /// <param name="startTime"></param>
        /// <param name="endTime"></param>
        /// <param name="session"></param>
        /// <returns></returns>
        public List<ZhuanHuaLvDateEntity> GetZhuanHuaLvByDate(DateTime startTime, DateTime endTime, string session, bool isContainALLDate, string sellerNick)
        {
            List<ZhuanHuaLvDateEntity> zhuanHuaLvDateEntityList = new List<ZhuanHuaLvDateEntity>();
            var gridViewModel = WangWangAPI.GetWangwangEserviceReceivenumGetResponse(startTime, endTime, session, sellerNick);
            var a = new GridViewModelBusiness().GetChatpeersViewModel(startTime, endTime, session, sellerNick);

            gridViewModel.ReplyStatListOnDays.ForEach(item =>
            {
                ZhuanHuaLvDateEntity zhuanHuaLvDateEntity = new ZhuanHuaLvDateEntity();
                zhuanHuaLvDateEntity.OrderDate = item.ReplyDate;
                zhuanHuaLvDateEntity.AdvisoryPersonCount = item.ReplyStatByIds.Sum(s => s.ReplyNum);
                zhuanHuaLvDateEntity.TeamPersonBuyCount = 1;

                zhuanHuaLvDateEntityList.Add(zhuanHuaLvDateEntity);
            });

            return zhuanHuaLvDateEntityList;
        }
    }
}
